<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>从前端发起请求，请求JSON数据</title>
</head>
<body>
    <script>
        var xhr = new XMLHttpRequest();
        xhr.open("GET", "/message-list.json");
        xhr.addEventListener("load", function(){
            console.log(this.responseText);
            var messageList = JSON.parse(this.responseText);
            console.log(messageList);
        });
        xhr.send();
    </script>
</body>
</html>